import {request} from './request';
//登录接口
let login = params => request.post('/login',params);
// // 注册接口
let register = params => request.put('/register',params);
// 获取验证码接口
let validCode = () => request.get('/validCode');
// 获取收货地址
let getaddr = () => request.get('/addr');
// 添加收货地址
let putaddr = params => request.put('/addr', params);
// 删除收货地址
let deleteaddr = data => request.delete('/addr', data);
// 修改收货地址
let reviseadd = params => request.post('/addr', params);
// 设置默认地址
let defaultAddr = params => request.post('/defaultAddr', params);
// 获取商品数据
let product = data => request.get('/prod', {params: data});
// 获取轮播图
let RotationChart = () => request.get('/banner');
// 获取秒杀商品
let SpikeMerchandise = () => request.get('/secKill');
// 添加商品到购物车
let shoppingCart = params => request.put('/cart', params);
// 获取购物车的商品
let commodity = () => request.get('./cart');
// 删除购物车的商品
let shoppingDel = params => request.post('/delcart', params);
// 获取购物车的商品数量
let cartCount = () => request.get('/cartCount');
// 更新购物车的商品数量
let ToUpdate = params => request.post('./cart', params);
// 商品搜索
let searchProd = (data) => request.get('/searchProd', {params: data});
// 创建订单
let CreateOrder = params => request.put('/order', params);
// 支付
let payment = params => request.post('/pay', params);
export const apis = {
  validCode, register, login, getaddr, putaddr, deleteaddr,
  reviseadd, defaultAddr, product, RotationChart, SpikeMerchandise,
  shoppingCart, commodity, shoppingDel, cartCount, ToUpdate,
  searchProd, CreateOrder, payment
};
